package cn.doit.day03

object _05_继承 {
  def main(args: Array[String]): Unit = {
    val zi: Fu = new Zi()
    println(zi.name)//思聪
    println(zi.age)
  }
}

class Fu(){
  val id:Int =1
  val name:String = "马爹"
  val age:Int = 66
  def playCards()={
    println("澳门走一走，活到99")
  }
  def fish()={
    println("我是爸爸，我会钓鱼")
  }

}

//1.子类继承父类得时候，会将父类得构造方法一起继承过来
//2.父类有得属性，子类就不能再有了   重写
class Zi() extends Fu(){
  val address:String = "魔方公寓"
  val phone:String = "58888888"
  val height:Double = 1.85

  override val id: Int = 2
  override val name: String = "思聪"

  override def playCards(): Unit = {
    println("我也去走了一遭，输光了")
  }

  def playGames()={
    println("俺是最强王者")
  }

  def watchFeet()={
    println("宝明比较擅长！！！")
  }

}
